#pragma once
#include <Ice/Connection.h>
namespace Demo {
	class CallbackSenderImpl;
}
class BirConnection : public Ice::ConnectionCallback
{
public:
	BirConnection(const ::std::string& _clientId = "", Demo::CallbackSenderImpl* _pCallbackSenderImpl = nullptr);

	~BirConnection();
	//注册客户端的关闭回调函数
	void SetClientCloseHandler(const std::shared_ptr<std::function<void()>>& _fun);
public:
	virtual void heartbeat(const Ice::ConnectionPtr& connection)override;

	virtual void closed(const Ice::ConnectionPtr& connection) override;
private:
	//m_pCallbackSenderImpl = nullptr,说明是客户端，否则为服务端
	Demo::CallbackSenderImpl* m_pCallbackSenderImpl = nullptr;
	std::string m_ClientID;
	std::shared_ptr<std::function<void()>> m_pFun = nullptr;
};

